﻿@{
    Html.LOBHtmlHelper().SetLayout(this);  
}
@{Html.RenderPartial("LinkPath");}

<div class="mtitle">
    @ViewBag.Title
</div>

@Html.LOBHtmlHelper().Busy("busyMain")

<table  cellpadding="1" cellspacing="1" style="table-layout:fixed;" width="100%">
    <tr>
        <td style="width: 100%;height:100%" valign="top">
            @Html.LOBHtmlHelper().GridView()
        </td>
    </tr>
</table>

<script type="text/javascript">

    var _codeBaseGrid = new CodeBaseGrid();
    $(document).ready(function () {
        _codeBaseGrid.Init(
            "grvtblSetupSequences",
            "SequenceID",
            "@Url.Action("View","SetupSequences")",
            "@Url.Action("Edit","SetupSequences")",
            "@Url.Action("Add","SetupSequences")",
            "@Url.Action("Delete","SetupSequences")",
            "@Url.Action("Save","SetupSequences")",
            "AD",
            "AD_tblSetupSequences",
            "rptSetupSequences"
            );
        _codeBaseGrid.SetWidthPupop(650);
        _codeBaseGrid.SetHeightPupop(370);
    });

    function View(addOnGrid) {
        _codeBaseGrid.View(addOnGrid);
    }

    function Add(addOnGrid) {
        _codeBaseGrid.Add(addOnGrid);
    }

    function Edit(addOnGrid) {
        _codeBaseGrid.Edit(addOnGrid);
    }

    function Delete(addOnGrid) {
        _codeBaseGrid.Delete(addOnGrid);
    }

    function Save() {
        _codeBaseGrid.Save();
    }

    function Undo() {
        _codeBaseGrid.Undo();
    }

    function Print() {
        _codeBaseGrid.Print();
    }

    function Copy(addOnGrid) {
        _codeBaseGrid.Copy(addOnGrid);
        if (addOnGrid == "True")
        {
            SetValueForGrid("grvtblSetupSequences", "LastNumber", 0);
        }
    }

    function EnableToolBarBusiness(data) {
        if (!data.RowSystem) {
            document.getElementById('btnDelete').disabled = false;
            document.getElementById('btnDelete').className = "positive";
        }
        else {
            document.getElementById('btnDelete').disabled = true;
            document.getElementById('btnDelete').className = "disabled";
        }

        document.getElementById('btnPrint').disabled = true;
        document.getElementById('btnPrint').className = "disabled";
    }

    function RowChange(data) {
        EnableToolBarBusiness(data);
    }

    function onGridEdit() {
        var current = GetCurrentRow("grvtblSetupSequences");
        if (current != null && current.RowSystem)
        {
            _codeBaseGrid.IsReadOnly("SequenceID", true);
            codeBasePopup.IsReadOnly("MaxLenght", true);
        }
        else
        {
            _codeBaseGrid.IsReadOnly("SequenceID", false);
            codeBasePopup.IsReadOnly("MaxLenght", false);
        }
        
    }


</script>
